<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Command Line Functions</title><meta name="generator" content="DocBook XSL Stylesheets V1.76.1"><meta name="keywords" content="Intellon, Atheros, Qualcomm, HomePlug, powerline, communications, INT6000, INT6300, INT6400, AR7400, AR7420"><link rel="home" href="index.html" title="Qualcomm Atheros Open Powerline Toolkit"><link rel="up" href="ch07.html" title="Chapter 7.  Support Function Reference"><link rel="prev" href="ch07.html" title="Chapter 7.  Support Function Reference"><link rel="next" href="ch07s03.html" title="Ethernet Functions"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">
			Command Line Functions
			</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch07.html">Prev</a> </td><th width="60%" align="center">Chapter 7. 
		Support Function Reference
		</th><td width="20%" align="right"> <a accesskey="n" href="ch07s03.html">Next</a></td></tr></table><hr></div><div class="section" title="Command Line Functions"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="support-command"></a>
			Command Line Functions
			</h2></div></div></div><p>
			Command line functions are used by all toolkit programs. They are generic functions but we include them in a special section because they collectively co-operate to convert command line options and arguments into appropriate binary representations and provide concise but meaningful feedback when that is not possible.
			</p><div class="section" title="assist"><div class="titlepage"><div><div><h3 class="title"><a name="support-assist"></a>
			assist
			</h3></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">void <b class="fsfunc">assist</b>(</code></td><td><var class="pdparam">name</var>, </td><td> </td></tr><tr><td> </td><td><var class="pdparam">type</var>, </td><td> </td></tr><tr><td> </td><td><var class="pdparam">list</var>, </td><td> </td></tr><tr><td> </td><td><var class="pdparam">size</var>, </td><td> </td></tr><tr><td> </td><td><var class="pdparam">fp</var><code>)</code>;</td><td> </td></tr></table><div class="paramdef-list"><code>char const * <var class="pdparam">name</var></code>;<br><code>char const * <var class="pdparam">type</var></code>;<br><code>const struct _code_ <var class="pdparam">list</var> []</code>;<br><code>size_t <var class="pdparam">size</var></code>;<br><code>FILE * <var class="pdparam">fp</var></code>;</div><div class="funcprototype-spacer"> </div></div><p>
			Show why a symbolic <code class="varname">name</code> was rejected by function <a class="link" href="ch07s02.html#support-lookup" title="lookup">lookup</a> or similar functions. Argument <code class="varname">type</code> contains a title for the class of names stored in <code class="varname">list</code>. This function prints an error message on file stream <code class="constant">fp</code> showing the program name,  the <code class="varname">type</code> string,  the symbolic <code class="varname">name</code> and all names stored in the <code class="varname">list</code>. The <code class="constant">_code_</code> structure is declared in <a class="ulink" href="types.h.html" target="_top">types.h</a>. The function is declared in <a class="ulink" href="symbol.h.html" target="_top">symbol.h</a> and defined in <a class="ulink" href="assist.c.html" target="_top">assist.c</a>. Function <a class="link" href="ch07s02.html#support-expect" title="expect">expect</a> is used to print list names.
			</p></div><div class="section" title="basespec"><div class="titlepage"><div><div><h3 class="title"><a name="support-basespec"></a>
			basespec
			</h3></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">uint64_t <b class="fsfunc">basespec</b>(</code></td><td><var class="pdparam">string</var>, </td><td> </td></tr><tr><td> </td><td><var class="pdparam">base</var>, </td><td> </td></tr><tr><td> </td><td><var class="pdparam">size</var><code>)</code>;</td><td> </td></tr></table><div class="paramdef-list"><code>char const * <var class="pdparam">string</var></code>;<br><code>unsigned <var class="pdparam">base</var></code>;<br><code>unsigned <var class="pdparam">size</var></code>;</div><div class="funcprototype-spacer"> </div></div><p>
			Return the unsigned integer equivalent of a numeric <code class="varname">string</code>. Print an error message on <code class="varname">stderr</code> and exit the program with status <code class="constant">1</code> if a syntax error occurs or the result exceeds the capacity of the requested integer <code class="varname">size</code> in bytes. If <code class="varname">base</code> is <code class="constant">0</code>,  numeric values may be expressed in decimal, hexadecimal or binary notation where hexadecimal values start with <code class="constant">"0x"</code> and binary values start with <code class="constant">"0b"</code>. When <code class="varname">base</code> is non-zero, the notation in <code class="varname">string</code> must conform to the corresponding number base rules. Applications should cast the return value to the appropriate data type prevent loss-of-data compiler warnings. This function is typically used to convert and length-check integers entered as command line arguments. The function is declared in <a class="ulink" href="number.h.html" target="_top">number.h</a> and defined in <a class="ulink" href="basespec.c.html" target="_top">basespec.c</a>.
			</p><p>
			Like function <a class="link" href="ch07s02.html#support-uintspec" title="uintspec">uintspec</a>,  this function both converts and range checks numeric string values,  but the minimum and maximum value are implicit in the <code class="varname">size</code> of the integer. The minimum value is always <code class="constant">0</code> and the maximum value can be computed by  <code class="constant">((1 &lt;&lt; size &lt;&lt; 3) - 1)</code>.
			</p></div><div class="section" title="bytespec"><div class="titlepage"><div><div><h3 class="title"><a name="support-bytespec"></a>
			bytespec
			</h3></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">void <b class="fsfunc">bytespec</b>(</code></td><td><var class="pdparam">string</var>, </td><td> </td></tr><tr><td> </td><td><var class="pdparam">memory</var>, </td><td> </td></tr><tr><td> </td><td><var class="pdparam">extent</var><code>)</code>;</td><td> </td></tr></table><div class="paramdef-list"><code>char const * <var class="pdparam">string</var></code>;<br><code>void  * <var class="pdparam">memory</var></code>;<br><code>size_t <var class="pdparam">extent</var></code>;</div><div class="funcprototype-spacer"> </div></div><p>
			Encode a <code class="varname">memory</code> region with the binary equivalent of a fixed-length hexadecimal string. Print an error message on stderr and exit the program with status <code class="constant">1</code> if a syntax error occurs or the number of octets does not equal  <code class="varname">extent</code>. Hexadecimal octets may be separated by colons for readability but colons are not required. Empty octets are illegal. The function is declared in <a class="ulink" href="memory.h.html" target="_top">memory.h</a> and defined in <a class="ulink" href="bytespec.c.html" target="_top">bytespec.c</a>.
			</p><p>
			This function is typically used to enter fixed-length data, like hardware addresses and encryption keys, on the command line. 
			</p></div><div class="section" title="checkfilename"><div class="titlepage"><div><div><h3 class="title"><a name="support-checkfilename"></a>
			checkfilename
			</h3></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">bool <b class="fsfunc">checkfilename</b>(</code></td><td><var class="pdparam">filename</var><code>)</code>;</td><td> </td></tr></table><div class="paramdef-list"><code>char const * <var class="pdparam">filename</var></code>;</div><div class="funcprototype-spacer"> </div></div><p>
				Return logical <code class="constant">true</code> if the <code class="varname">filename</code> argument contains only letters, digits, slashes, periods, underscores and hyphens. This function can be used to detect cases where a user accidentally entered an Ethernet address in place of a filename on the command line. Ethernet address strings are, as it happens, also valid filenames. The function is declared in <a class="ulink" href="files.h.html" target="_top">files.h</a> and defined in <a class="ulink" href="checkfilename.c.html" target="_top">checkfilename.c</a>.
				</p></div><div class="section" title="dataspec"><div class="titlepage"><div><div><h3 class="title"><a name="support-dataspec"></a>
			dataspec
			</h3></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">void <b class="fsfunc">dataspec</b>(</code></td><td><var class="pdparam">string</var>, </td><td> </td></tr><tr><td> </td><td><var class="pdparam">memory</var>, </td><td> </td></tr><tr><td> </td><td><var class="pdparam">extent</var><code>)</code>;</td><td> </td></tr></table><div class="paramdef-list"><code>char const * <var class="pdparam">string</var></code>;<br><code>void  * <var class="pdparam">memory</var></code>;<br><code>size_t <var class="pdparam">extent</var></code>;</div><div class="funcprototype-spacer"> </div></div><p>
			Encode a <code class="varname">memory</code> region with the binary equivalent of a variable-length hexadecimal string. Print an error message on stderr and exit the program with the status <code class="constant">1</code> if a syntax error occurs or the number of octets exceeds <code class="varname">extent</code>. The number of octets may, however, be less than <code class="constant">extent</code>. Unlike function <a class="link" href="ch07s02.html#support-bytespec" title="bytespec">bytespec</a>, hexadecimal octets may not be separated by colons. This function is typically used to enter variable-length data from the command line. The function is declared in <a class="ulink" href="memory.h.html" target="_top">memory.h</a> and defined in <a class="ulink" href="dataspec.c.html" target="_top">dataspec.c</a>.
			</p></div><div class="section" title="error"><div class="titlepage"><div><div><h3 class="title"><a name="support-error"></a>
			error
			</h3></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">void <b class="fsfunc">error</b>(</code></td><td><var class="pdparam">exitcode</var>, </td><td> </td></tr><tr><td> </td><td><var class="pdparam">number</var>, </td><td> </td></tr><tr><td> </td><td><var class="pdparam">format</var>, </td><td> </td></tr><tr><td> </td><td><var class="pdparam">...</var><code>)</code>;</td><td> </td></tr></table><div class="paramdef-list"><code>int<var class="pdparam">exitcode</var></code>;<br><code>errno_t <var class="pdparam">number</var></code>;<br><code>char const * <var class="pdparam">format</var></code>;<br><code><var class="pdparam">...</var></code>;</div><div class="funcprototype-spacer"> </div></div><p>
			This function works like printf except that printed messages appear on <code class="constant">stderr</code> and are prefixed with the program name and error information. If argument <code class="varname">errno</code> is non-zero then messages are prefixed with the system error description. If argument <code class="varname">exitcode</code> is non-zero then function <code class="varname">error</code> exits the program with value <code class="varname">exitcode</code> after printing the message and does not return to the caller. The function is declared in <a class="ulink" href="error.h.html" target="_top">error.h</a> and defined in <a class="ulink" href="error.c.html" target="_top">error.c</a>.
			</p><p>
			This function is used to print informative error messages on the console and prevent program execution from proceeding when input is invalid or some error condition exists.
			</p></div><div class="section" title="expect"><div class="titlepage"><div><div><h3 class="title"><a name="support-expect"></a>
			expect
			</h3></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">void <b class="fsfunc">expect</b>(</code></td><td><var class="pdparam">list</var>, </td><td> </td></tr><tr><td> </td><td><var class="pdparam">size</var>, </td><td> </td></tr><tr><td> </td><td><var class="pdparam">fp</var><code>)</code>;</td><td> </td></tr></table><div class="paramdef-list"><code>const struct _code_ <var class="pdparam">list</var> []</code>;<br><code>size_t <var class="pdparam">size</var></code>;<br><code>FILE * <var class="pdparam">fp</var></code>;</div><div class="funcprototype-spacer"> </div></div><p>
			Display all names in argument <code class="varname">list</code> on file stream <code class="varname">fp</code>. This function is called by runction <a class="link" href="ch07s02.html#support-assist" title="assist">assist</a> to print the list of symbolic names but other function may have use for it. The <code class="constant">_code_</code> structure is declared in <a class="ulink" href="types.h.html" target="_top">types.h</a>. The function is declared in <a class="ulink" href="symbol.h.html" target="_top">symbol.h</a> and defined in <a class="ulink" href="expect.c.html" target="_top">expect.c</a>.
			</p></div><div class="section" title="getoptv"><div class="titlepage"><div><div><h3 class="title"><a name="support-getoptv"></a>
			getoptv
			</h3></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">int <b class="fsfunc">getoptv</b>(</code></td><td><var class="pdparam">argc</var>, </td><td> </td></tr><tr><td> </td><td><var class="pdparam">argv</var>, </td><td> </td></tr><tr><td> </td><td><var class="pdparam">optv</var><code>)</code>;</td><td> </td></tr></table><div class="paramdef-list"><code>int <var class="pdparam">argc</var></code>;<br><code>char const * <var class="pdparam">argv</var> []</code>;<br><code>char const * <var class="pdparam">optv</var> []</code>;</div><div class="funcprototype-spacer"> </div></div><p>
			A custom version of the <acronym class="acronym">POSIX</acronym> function <code class="function">getopt</code>. It supports standard global variables <code class="varname">optind</code>, <code class="varname">opterr</code>, <code class="varname">optopt</code> and <code class="varname">optarg</code> and the non-standard variable <code class="varname">optmin</code>. It extracts the program name from <code class="varname">argv[0]</code> and sets global string pointer <code class="varname">program_name</code> for use by functions <code class="function">alert</code>, <code class="function">error</code> and others. Options <strong class="userinput"><code>-?</code></strong> and <strong class="userinput"><code>--help</code></strong> both display program information on <code class="constant">stdout</code>. Options <strong class="userinput"><code>-!</code></strong> and <strong class="userinput"><code>--version</code></strong> both display program version information on <code class="constant">stdout</code>. String vector <code class="varname">optv</code> includes both the standard argument <code class="varname">optstring</code> and usage text found in many programs. The function is declared in <a class="ulink" href="getoptv.h.html" target="_top">getoptv.h</a> and defined in <a class="ulink" href="getoptv.c.html" target="_top">getoptv.c</a>.
			</p></div><div class="section" title="ipv4spec"><div class="titlepage"><div><div><h3 class="title"><a name="support-ipv4spec"></a>
			ipv4spec
			</h3></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">size_t <b class="fsfunc">ipv4spec</b>(</code></td><td><var class="pdparam">string</var>, </td><td> </td></tr><tr><td> </td><td><var class="pdparam">memory</var><code>)</code>;</td><td> </td></tr></table><div class="paramdef-list"><code>char const * <var class="pdparam">string</var></code>;<br><code>void  * <var class="pdparam">memory</var></code>;</div><div class="funcprototype-spacer"> </div></div><p>
			Encode a 4-byte <code class="varname">memory</code> region with an IPv4 dotted-decimal <code class="varname">string</code> and return the number of bytes encoded. Terminate the program with an error message and exitcode of <code class="constant">1</code> on conversion error. The value returned by this function is always <code class="constant">4</code> and memory is always encoded in network byte order. This function is typically used to convert IPv4 strings entered as command line arguments. The function is declared in <a class="ulink" href="memory.h.html" target="_top">memory.h</a> and defined in <a class="ulink" href="ipv4spec.c.html" target="_top">ipv4spec.c</a>.
			</p><p>
			Dotted-decimal format consists of decimal values in the range 0 through 255. Each value represents one octet or 8-bit value. IPv4 addresses require 4 such values separated by one decimal point. This function permits empty octets and leading zeros within octets. For example,  <span class="quote">“<span class="quote">...</span>”</span> is equivalent to <span class="quote">“<span class="quote">0.0.0.0</span>”</span> and <span class="quote">“<span class="quote">127.0.000.001</span>”</span> is equivalent to <span class="quote">“<span class="quote">127.0.0.1</span>”</span>. The second example will encode memory as follows <code class="constant">{ 0x7F, 0x00, 0x00, 0x01 }</code> which is in network byte order, or big endian.
			</p></div><div class="section" title="ipv6spec"><div class="titlepage"><div><div><h3 class="title"><a name="support-ipv6spec"></a>
			ipv6spec
			</h3></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">size_t <b class="fsfunc">ipv6spec</b>(</code></td><td><var class="pdparam">string</var>, </td><td> </td></tr><tr><td> </td><td><var class="pdparam">memory</var><code>)</code>;</td><td> </td></tr></table><div class="paramdef-list"><code>char const * <var class="pdparam">string</var></code>;<br><code>void  * <var class="pdparam">memory</var></code>;</div><div class="funcprototype-spacer"> </div></div><p>
			Encode a 16-byte <code class="varname">memory</code> region with an IPv6 colon-separated hexadecimal quartet <code class="varname">string</code> and return the number of bytes encoded. Terminate the program with an error message and exitcode of <code class="constant">1</code> on conversion error. The value returned by this function is always <code class="constant">16</code> and memory is always encoded in network byte order. This function is typically used to convert IPv6 strings entered as command line arguments. The function is declared in <a class="ulink" href="memory.h.html" target="_top">memory.h</a> and defined in <a class="ulink" href="ipv6spec.c.html" target="_top">ipv6spec.c</a>.
			</p><p>
			Colon-separated hexadecimal quartet notation consists of hexadecimal values in the range 0 through FFFF. Each value represents a quartet or a 32-bit value. IPv6 addresses require 8 quartets separated by one colon. By convention, an empty quartet expands with enough zeros to right-justify the remainder of the address. This function permits multiple empty quartets and leading zeros within quartets. When multiple empty quartets appear, only the right-most occurance expands to zeros. For example,  <span class="quote">“<span class="quote">AA12::BB34::CC56::DD78</span>”</span> is equivalent to <span class="quote">“<span class="quote">AA12:0000:BB34:0000:CC56:0000:0000:DD78</span>”</span> because only the right-most empty field expands. This will encode memory as follows <code class="constant">{ 0xAA, 0x12, 0x00, 0x00, 0xBB, 0x34, 0x00, 0x00, 0xCC, 0x56, 0x00, 0x00, 0x00, 0x00, 0xDD, 0x78 }</code> which is in network byte order, or big-endian.
			</p></div><div class="section" title="lookup"><div class="titlepage"><div><div><h3 class="title"><a name="support-lookup"></a>
			lookup
			</h3></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">signed <b class="fsfunc">lookup</b>(</code></td><td><var class="pdparam">name</var>, </td><td> </td></tr><tr><td> </td><td><var class="pdparam">list</var>, </td><td> </td></tr><tr><td> </td><td><var class="pdparam">size</var><code>)</code>;</td><td> </td></tr></table><div class="paramdef-list"><code>char const * <var class="pdparam">name</var></code>;<br><code>const struct _code_ <var class="pdparam">list</var> []</code>;<br><code>size_t <var class="pdparam">size</var></code>;</div><div class="funcprototype-spacer"> </div></div><p>
			Lookup a symbolic <code class="varname">name</code> in a <code class="varname">list</code> and return an associated integer or <code class="constant">-1</code> if the <code class="varname">name</code> does not appear in the <code class="varname">list</code>. A typical use is the translation of symbolic command line arguments to integer codes. For example, some Toolkit programs assign symbolic names to field codes so that users can enter names instead of numbers. This approach becomes more useful as the number of permitted codes increases. The <code class="constant">_code_</code> structure is declared in <a class="ulink" href="types.h.html" target="_top">types.h</a>. The function is declared in <a class="ulink" href="symbol.h.html" target="_top">symbol.h</a> and defined in <a class="ulink" href="lookup.c.html" target="_top">lookup.c</a>.
			</p><p>
			This function offers two benefits: 1) multiple symbols can translate to one code and 2) names can be changed or new names added without affecting program logic. This function is similar to but different from function <a class="link" href="ch07s02.html#support-synonym" title="synonym">synonym</a> which returns a character string instead of an integer. 
			</p></div><div class="section" title="putoptv"><div class="titlepage"><div><div><h3 class="title"><a name="support-putoptv"></a>
			putoptv
			</h3></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">void <b class="fsfunc">putoptv</b>(</code></td><td><var class="pdparam">optv</var><code>)</code>;</td><td> </td></tr></table><div class="paramdef-list"><code>char const * <var class="pdparam">optv</var> []</code>;</div><div class="funcprototype-spacer"> </div></div><p>
			Print program information on <code class="constant">stdout</code>. Program information is stored in string vector <code class="varname">optv</code>. String indexes are defined in file <code class="filename">putoptv.h</code>. String <code class="varname">optv[0]</code> is the <acronym class="acronym">POSIX</acronym> standard argument <code class="varname">optstring</code>. This function is called by function <code class="function">getoptv</code> whenever option <strong class="userinput"><code>-?</code></strong> or <strong class="userinput"><code>--help</code></strong> is detected on the command line. There is virtually no need to call this function directly. The function is declared in <a class="ulink" href="putoptv.h.html" target="_top">putoptv.h</a> and defined in <a class="ulink" href="putoptv.c.html" target="_top">putoptv.c</a>.
			</p></div><div class="section" title="synonym"><div class="titlepage"><div><div><h3 class="title"><a name="support-synonym"></a>
			synonym
			</h3></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">char const * <b class="fsfunc">synonym</b>(</code></td><td><var class="pdparam">string</var>, </td><td> </td></tr><tr><td> </td><td><var class="pdparam">list</var>, </td><td> </td></tr><tr><td> </td><td><var class="pdparam">size</var><code>)</code>;</td><td> </td></tr></table><div class="paramdef-list"><code>char const * <var class="pdparam">string</var></code>;<br><code>const struct _term_ <var class="pdparam">list</var> []</code>;<br><code>size_t <var class="pdparam">size</var></code>;</div><div class="funcprototype-spacer"> </div></div><p>
			Lookup a symbolic <code class="varname">name</code> in a <code class="varname">list</code> and return an associated string or the original <code class="varname">string</code> if the <code class="varname">name</code> does not appear in the <code class="varname">list</code>. A typical use is the translation of symbolic command line arguments to their equivalent numeric strings before encoding them. For example, many Toolkit programs convert the command line argument <span class="quote">“<span class="quote">local</span>”</span> to <span class="quote">“<span class="quote">00:B0:52:00:00:01</span>”</span> before encoding the device MAC address. The <code class="constant">_term_</code> structure is declared in <a class="ulink" href="types.h.html" target="_top">types.h</a>. The function is declared in <a class="ulink" href="symbol.h.html" target="_top">symbol.h</a> and defined in <a class="ulink" href="synonym.c.html" target="_top">synonym.c</a>.
			</p><p>
			This function is similar to but different from function <a class="link" href="ch07s02.html#support-lookup" title="lookup">lookup</a> which returns an integer instead of a character string.
			</p></div><div class="section" title="uintspec"><div class="titlepage"><div><div><h3 class="title"><a name="support-uintspec"></a>
			uintspec
			</h3></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">uint64_t <b class="fsfunc">uintspec</b>(</code></td><td><var class="pdparam">string</var>, </td><td> </td></tr><tr><td> </td><td><var class="pdparam">minimum</var>, </td><td> </td></tr><tr><td> </td><td><var class="pdparam">maximum</var><code>)</code>;</td><td> </td></tr></table><div class="paramdef-list"><code>char const * <var class="pdparam">string</var></code>;<br><code>uint64_t <var class="pdparam">minimum</var></code>;<br><code>uint64_t <var class="pdparam">maximum</var></code>;</div><div class="funcprototype-spacer"> </div></div><p>
			Return the unsigned integer equivalent of a numeric <code class="varname">string</code>. Print an error message on <code class="varname">stderr</code> and exit the program with the value <code class="constant">1</code> when a syntax error occurs or the result exceeds the specified <code class="varname">minimum</code> or <code class="varname">maximum</code> value. Numeric values may be expressed in decimal, hexadecimal or binary notation where hexadecimal values start with <code class="constant">"0x"</code> and binary values start with <code class="constant">"0b"</code>. Applications should cast the return value to the appropriate data type to avoid loss-of-data warnings on some compilers. This function is typically used to convert and range-check integer values entered as command-line arguments. The function is declared in <a class="ulink" href="number.h.html" target="_top">number.h</a> and defined in <a class="ulink" href="uintspec.c.html" target="_top">uintspec.c</a>.
			</p></div><div class="section" title="version"><div class="titlepage"><div><div><h3 class="title"><a name="support-version"></a>
			version
			</h3></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">void <b class="fsfunc">version</b>(</code></td><td><code>)</code>;</td><td> </td></tr></table><div class="funcprototype-spacer"> </div></div><p>
			Print package and program version information on <code class="constant">stdout</code>. This function is called by function <code class="function">getoptv</code> whenever option <strong class="userinput"><code>-!</code></strong> or <strong class="userinput"><code>--version</code></strong> is detected on the command line. There is no need to call this function directly. The function is declared in <a class="ulink" href="version.h.html" target="_top">version.h</a> and defined in <a class="ulink" href="version.c.html" target="_top">version.c</a>. Constants <code class="constant">PACKAGE</code> and <code class="constant">VERSION</code> define the information that is displayed. They are defined in file <a class="ulink" href="version.h.html" target="_top">version.h</a> and must be maintained by developers. 
			</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch07.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch07.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch07s03.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 7. 
		Support Function Reference
		 </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 
		Ethernet Functions
		</td></tr></table></div></body></html>
